ODF contains utilities routines for implementing "Save As…" dialog functionality. You will need to use them when writing a Cyberdog-savvy part, or for any other situtions where you can export multiple kinds of data.
What it does:
The FW_AskSaveAs function will present a save dialog with an additional menu control (to choose the saved format).
How to use it:
• Create an FW_SaveAsInfo resource. It will look like this:
resource FW_SaveAsInfo (1000)
{
"Save a copy as:",
{
"as OpenDoc™ Document",
"as Internet Reference",
"as Picture"
}
};
• Add menu handling to your part by overriding FW_CPart::DoMenu, and adding the following code to your override:
if (id == kODCommandSaveACopy)
{
FW_PFileSpecification whatFile(ev, "");
short whatKind;
FW_Boolean doIt = ::FW_AskSaveAs(this, 1000, "myPicture", whatFile, whatKind);
if (doIt)
{
// add your file saving code here
}
}
When FW_AskSaveAs returns, the values of the parameters you passed will be as follows:
- whatFile will be set to the destination file that the user selected.
- whatKind will be set to the value of the menu control. It defaults to 1.
The function result of FW_AskSaveAs will be false if the user chose Cancel, otherwise it will be true.
• Add FWSaveAs.rsrc to your project (it is in :ODF:Internet:).
Note: the code is in the ODFInternet project, so you will have to build and link against ODFInternet.lib.
Examples:
Use of the Save As utility is demonstrated in ODFBitmap.